import myAxios from './utils/myAxios'
import utilConfig from './utils/permission'
import checkPermission from './utils/checkPermission'
import PubSub from 'pubsub-js'
import moment from 'moment'
App({
    onLaunch(){
        const pageFn = Page
        Page = function(config) {
            config.$myAxios = myAxios
            config.$PubSub = PubSub
            config.$moment = moment
            const showFn = config.onShow
            config.onShow = function(){
                if(utilConfig.checkPermissons[this.route]) {
                    if(!checkPermission()) return 
                }
                showFn.call(this)
            }
            return pageFn(config)
        }
    },
    globalData: {}
})